package com.cool.modules.finance.controller.admin;

import cn.hutool.json.JSONObject;
import com.cool.core.annotation.CoolRestController;
import com.cool.core.exception.CoolException;
import com.cool.core.request.R;
import com.cool.modules.finance.service.statistics.FinanceStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;

@Tag(name = "小金库统计信息", description = "小金库统计信息")
@CoolRestController
@RequiredArgsConstructor
public class AdminFinanceStatisticsController {

    final FinanceStatisticsService financeStatisticsService;


    @Operation(summary = "消费统计信息", description = "消费统计信息")
    @PostMapping("/payChart")
    public R payChart(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.consumerInformationStatistics(requestParams));
    }

    @Operation(summary = "消费笔数统计信息", description = "消费笔数统计信息")
    @PostMapping("/countView")
    public R countView(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.paymentCountStatistics(requestParams));
    }

    @Operation(summary = "消费金额统计信息", description = "消费金额统计信息")
    @PostMapping("/countPaid")
    public R countPaid(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.paymentAmountStatistics(requestParams));
    }

    @Operation(summary = "账户金额统计信息", description = "账户金额统计信息")
    @PostMapping("/accountBalance")
    public R accountBalance(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.accountBalanceStatistics(requestParams));
    }

    @Operation(summary = "近12月收入支出统计", description = "近12月收入支出统计")
    @PostMapping("/tabChart")
    public R tabChart(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.tabChartStatistics(requestParams));
    }

    @Operation(summary = "支出消费排名", description = "支出消费排名")
    @PostMapping("/expendRank")
    public R expendRank(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.expendRank(requestParams));
    }

    @Operation(summary = "理财排名", description = "理财排名")
    @PostMapping("/profitSearch")
    public R profitSearch(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.profitSearch(requestParams));
    }

    @Operation(summary = "支出类别占比", description = "支出类别占比")
    @PostMapping("/categoryRatio")
    public R categoryRatio(@RequestAttribute()JSONObject requestParams) {
        return R.ok(this.financeStatisticsService.categoryRatio(requestParams));
    }

}
